#!/bin/bash

# custom work directory
ACHOME=/home/smbxy/az_repo/repos

mkdir -p ${ACHOME}/build
mkdir -p ${ACHOME}/azerothcore-wotlk/build
cd  ${ACHOME}/azerothcore-wotlk/build

cmake ../ -DCMAKE_INSTALL_PREFIX=${ACHOME}/build/ \
 -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
 -DWITH_WARNINGS=1 -DTOOLS=0 -DSCRIPTS=static


######################################################################################
#按i进入编辑模式，在“bind-address= 127.0.0.1”前面输入#，按Esc，输入“:wq”回车
vim /etc/mysql/mysql.conf.d/mysqld.cnf
service mysql restart  #重启mysql
mysql -uroot -p
use mysql;
#此处为修改MySQL的root密码，新密码即你自己设置的密码，这里我设置为了gswxy.com，不要忘记！
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';
update user set host = '%' where user ='root';

#创建acore用户，如果你想使用root管理AC数据库，此条不用输入
source /azerothcore/data/sql/create/create_mysql.sql
FLUSH PRIVILEGES;
exit;

#输入5以选择import-all: Assemble & Import all，导入数据库
bash apps/db_assembler/db_assembler.sh

# 客户端登录配置
cat ~/.my.cnf 
[client]
user = root
password = 12345678
host = 127.0.0.1
######################################################################################
apt-get update
apt-get install -y git vim curl rename screen zip unzip tmux tzdata ntpdate
timedatectl set-timezone Asia/Shanghai
# 环境安装
apt-get install -y git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev mysql-server libboost-all-dev

export LANG=C.UTF-8
#在 Dockerfile 构建镜像可以加： ENV LANG C.UTF-8
######################################################################################
# repo cmd example

# 下载 repo 工具，来源 https://android.googlesource.com/tools/repo
# wget https://gitee.com/brucemo/repo/raw/master/repo -O /usr/bin/repo
# chmod +x /usr/bin/repo

# 初始化
# repo init -u https://gitee.com/brucemo/acore_manifest -b master -m default.xml --repo-url=https://gitee.com/brucemo/repo  --no-repo-verify

# 同步代码 忽略 "curl: (22) The requested URL returned error: 404" 提示
# repo sync -v

# 切换分支
# repo start master --all

# 一些 forall 操作
# repo forall -g mod -c 'git remote -v'

######################################################################################
